#define _CRT_SECURE_NO_WARNINGS 1

#include"List.h"

void Test1()
{
	LTNode* plist = LTCreate();
	LTPushBack(plist,1);
	LTPushBack(plist,2);
	LTPushBack(plist,3);
	LTPushBack(plist,4);
	LTPushBack(plist,5);

	LTPrint(plist);

	LTPopBack(plist);
	LTPopBack(plist);
	LTPrint(plist);

	LTDestory(plist);
}

void Test2()
{
	LTNode* plist = LTCreate();
	LTPushBack(plist, 1);
	LTPushBack(plist, 2);
	LTPushBack(plist, 3);
	LTPushBack(plist, 4);
	LTPushBack(plist, 5);

	LTPushFront(plist, 1);
	LTPrint(plist);

	LTPopFront(plist);
	LTPrint(plist);
	LTPopFront(plist);
	LTPrint(plist);
	LTPopFront(plist);
	LTPrint(plist);
	LTPopFront(plist);
	LTPrint(plist);
	LTDestory(plist);
}

void Test3()
{
	LTNode* plist = LTCreate();
	LTPushBack(plist, 1);
	LTPushBack(plist, 2);
	LTPushBack(plist, 3);
	LTPushBack(plist, 4);
	LTPushBack(plist, 5);
	LTPrint(plist);

	LTNode* pos = LTFind(plist,3);
	if (pos)
	{
		pos->val *= 30;
	}
	LTPrint(plist);

	LTDestory(plist);
}
void Test4()
{
	LTNode* plist = LTCreate();
	LTPushBack(plist, 1);
	LTPushBack(plist, 2);
	LTPushBack(plist, 3);
	LTPushBack(plist, 4);
	LTPushBack(plist, 5);
	LTPrint(plist);

	LTNode* pos = LTFind(plist, 3);
	if (pos)
	{
		LTErase(pos);
	}
	LTPrint(plist);

	LTDestory(plist);
}

void Test5()
{
	LTNode* plist = LTCreate();
	LTPushBack(plist, 1);
	LTPushBack(plist, 2);
	LTPushBack(plist, 3);
	LTPushBack(plist, 4);
	LTPushBack(plist, 5);
	LTPrint(plist);

	LTNode* pos = LTFind(plist, 1);
	if (pos)
	{
		//LTErase(pos);
	}
	LTPrint(plist);

	LTInsert(plist, -1);

	LTPrint(plist);

	LTDestory(plist);
}
int main()
{
	Test1();
	return 0;
}